//
//  ViewController.m
//  ZUIVogue
//
//  Created by yaohongchao on 16/12/12.
//  Copyright © 2016年 yaohongchao. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setui];
    // Do any additional setup after loading the view, typically from a nib.
}

-(void)setui{
    self.view.backgroundColor = [UIColor whiteColor];
    
    NSArray *vcNames=@[@{@"vcName":@"UIViewController",
                         @"title":@"画报",
                         @"imageNor":@"tabbar_magazine_unselected",
                         @"imageSel":@"tabbar_magazine_selected"
                         },
                       @{@"vcName":@"ZUIVCGoods",
                         @"title":@"有物",
                         @"imageNor":@"tabbar_discover_unselected",
                         @"imageSel":@"tabbar_discover_selected"
                         },
                       @{@"vcName":@"UIViewController",
                         @"title":@"设计师",
                         @"imageNor":@"tabbar_designer_unselected",
                         @"imageSel":@"tabbar_designer_selected"
                         },
                       @{@"vcName":@"UIViewController",
                         @"title":@"我",
                         @"imageNor":@"tabbar_mine_unselected",
                         @"imageSel":@"tabbar_mine_selected"
                         }];
    
    for (NSDictionary *dict in vcNames) {
        NSString *strVc=[dict objectForKey:@"vcName"];
        NSString *strTitle=[dict objectForKey:@"title"];
        NSString *strImgNor=[dict objectForKey:@"imageNor"];
        NSString *strImgSel=[dict objectForKey:@"imageSel"];

        UIViewController *vc = [[NSClassFromString(strVc) alloc]init];
        vc.hidesBottomBarWhenPushed = NO;
        UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:vc];
        nav.tabBarItem.image=[UIImage imageNamed:strImgNor];
        nav.tabBarItem.selectedImage = [UIImage imageNamed:strImgSel];
        nav.tabBarItem.title=strTitle;
        [self addChildViewController:nav];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
